package com.hch.algorithm.recursion;

import org.springframework.stereotype.Component;

/**
 * @author HeCongHui
 * @date 2022/7/4 17:28
 */
@Component
public class Visual {

    public int print(int n) {
        if (n == 0) {
            return 0;
        } else {
            System.out.println(n);
            return print(n - 1);
        }

    }

    public int fact(int n) {
        if (n == 0) {
            return 1;
        } else if (n == 1) {
            return 1;
        } else {
            System.out.println(n);
            return n * fact(n - 1);
        }

    }
}
